<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of test
 *
 * @author zhangxuelin
 */

/*
    $url = 'http://www.rkpass.cn/u.jsp?u=310069';
    $data_string = 'test=test';
    $URL_Info = parse_url($url);
    $request = "";
    if (!isset($URL_Info["port"])){
        $URL_Info["port"]=80;
    }
        
    
    
    $request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
    $request.="Host: ".$URL_Info["host"]."\n";
    $request.="Referer: ".$URL_Info["host"]."\n";
    $request.="Content-type: application/x-www-form-urlencoded\n";
    $request.="X-Forwarded-For:192.168.1.4\n";//HTTP_X_FORWARDED_FOR的值
    $request.="client_ip:192.168.1.5\n";//HTTP_CLIENT_IP的值
    $request.="Content-length: ".strlen($data_string)."\n";
    $request.="Connection: close\n";
    $request.="\n";
    $request.=$data_string."\n";

    $fp = fsockopen($URL_Info["host"], $URL_Info["port"]);
    fputs($fp, $request);
    $result = "";
    while(!feof($fp)) {
    $result .= fgets($fp, 1024);
    }
    fclose($fp);
    echo $result;
*/
/*
$url = 'http://www.rkpass.cn/u.jsp?u=310069';
$cUrl = curl_init();
curl_setopt($cUrl, CURLOPT_URL, $url);
curl_setopt($cUrl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cUrl, CURLOPT_HEADER, 1);
curl_setopt($cUrl, CURLOPT_USERAGENT, "Mozilla/99.99");
//curl_setopt($cUrl, CURLOPT_TIMEOUT, 10);
curl_setopt($cUrl, CURLOPT_PROXY, '125.77.194.103:80');
$c = curl_exec($cUrl);
curl_close($cUrl);
echo $c;
 * 
 */
$url = 'http://www.taoyiz.com/util/ip';
$data_string = 'test=test';
$URL_Info    =    parse_url($url);
$request = '';
if (!isset($URL_Info["port"])){
    $URL_Info["port"]=80;
}
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host: ".$URL_Info["host"]."\n";
$request.="Referer: ".$URL_Info["host"]."\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="X-Forwarded-For:192.168.1.4\n";//HTTP_X_FORWARDED_FOR的值
$request.="client_ip:61.215.19.87\n";//HTTP_CLIENT_IP的值
$request.="Content-length: ".strlen($data_string)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data_string."\n";
//套接字读取（原来可以这样用，直接对句柄fputs()和fgets()进行发送和接收）
$fp = fsockopen($URL_Info["host"], $URL_Info["port"]);
fputs($fp, $request);
$result = "";
while(!feof($fp)) {
$result .= fgets($fp,1024);
}
fclose($fp);
echo $result;